<?php

/**
 * code_leave_type module helper.
 *
 * @package    Amawal Invest
 * @subpackage code_leave_type
 * @author     Ameen Shoman<amin.shoman@gmail.com>
 * @version    SVN: $Id: helper.php 12474 2008-10-31 10:41:27Z fabien $
 */
class code_leave_typeGeneratorHelper extends BaseCode_leave_typeGeneratorHelper
{
    /**
     * Enter description here...
     *
     * @param CodeLeaveType $code_leave_type
     * @param unknown_type $params
     * @return unknown
     */

    public function linkToDelete($code_leave_type, $params)
    {
        if( 0 == $code_leave_type->countLinkEmployeeLeaves()  && 0 == $code_leave_type->countTransactions() ){
            return parent::linkToDelete($code_leave_type, $params);
        }else{
            return '';
            return $this->linkToActive( $code_leave_type , $params );
        }
    }
    /**
     * Enter description here...
     *
     * @param CodeLeaveType $code_leave_type
     * @param unknown_type $params
     * @return unknown
     */

    public function linkToActive(CodeLeaveType $code_leave_type, $params)
    {
        $active_lbl = $code_leave_type->getIsActive() ? __('de-activiate') :  __('Activiate');
        $class  = $code_leave_type->getIsActive() ? 'sf_admin_action_delete' :  'sf_admin_action_new';
        //die($this->getUrlForAction('activiate'));
        return '<li class="'.$class.'">'.link_to($active_lbl, $this->getUrlForAction('activiate'), $employee, array('method' => 'post', 'confirm' => !empty($params['confirm']) ? __($params['confirm'], array(), 'sf_admin') : $params['confirm'])).'</li>';
    }
}
